package com.hsp.Demo_05_extends.teacher;

public class Demo_Teacher {
    public static void main(String[] args) {
        /*Person p1 = new Person();
        Teacher t1 = new Teacher();
        Teacher t2 = new Teacher();
        Student s1 = new Student();
        Student s2 = new Student();

        Person[] p = {p1, t1, t2, s1, s2};

        for(int i = 0; i < p.length; i++){
            p[i].say();
            if(p[i] instanceof Teacher){
                ((Teacher)p[i]).teach();
            }else if(p[i] instanceof Student){
                ((Student)p[i]).study();
            }
        }*/

        Person[] p = new Person[5];
        p[0] = new Person();
        p[1] = new Teacher();
        p[2] = new Teacher();
        p[3] = new Student();
        p[4] = new Student();

        for (int i = 0; i < p.length; i++) {
            p[i].say();

        }

    }
}
